home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: C compiling question
- Date: 07 Mar 1996 15:19:47 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar7081947@qcd.lanl.gov>
- References: <3138D53F.41C6@mashie.ece.jhu.edu> <TANMOY.96Mar2225602@qcd.lanl.gov>
- <313CF1CA.167E@mashie.ece.jhu.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: Chenyang Xu's message of Tue, 05 Mar 1996 21:00:42 -0500
-
- In article <313CF1CA.167E@mashie.ece.jhu.edu>
- Chenyang Xu <chenyang@mashie.ece.jhu.edu> writes:
-
- <snip>
- CX: You are saying that when compiler are compiling source file separately
- CX: into object codes, it will assume all the undeclared but called
- CX: functions as "extern int some_fun()", then at the linking stage, the
-
- Actually, all the functions whose declarations are not known
- (technically `visible') at the point of their use are declared `extern
- int name();'. Note that extern does not mean that it has to be in a
- separate file: very commonly it is later in the same file.
-
- CX: linker will try to find whether there is a function by that name, if
- CX: not, displaying error message, if yes, then proceed smoothly without
- CX: checking the consistency of the function return types.
-
- Unfortunately, it puts this declaration in a block scope, which means
- when it finishes translating the current block, it forgets this
- declaration. So, even if the function is later defined in the same
- file with an incompatible definition (e.g. `char *name() {/* */}'),
- the compiler is not required to complain.
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-